package hxy.dragon.ktor.kotlin

import kotlin.test.Test

/**
 * @description
 * @author eric
 * @date 2024/10/28
 */
class LazyTest {

    /**
     * Lazy value not initialized yet.
     */
    @Test
    fun `test lazy`() {
        val lazyValue: String by lazy {
            println("Initializing lazyValue")
            "Hello, World!"
        }
        // 尝试在初始化之前访问 lazyValue
        if (lazyValue.isEmpty()) {
            println("lazyValue is empty")
        } else {
            println("lazyValue is not empty")
        }
    }
}